1 module unde.games.object; 2 3 import unde.games.obj_loader; 4 import unde.games.collision_detector; 5 import unde.global_state; 6 7 class GameObject 8 { 9 enum{ 10 LEFT_KEY = 0x01, 11 RIGHT_KEY = 0x02, 12 UP_KEY = 0x04, 13 DOWN_KEY = 0x08, 14 CTRL_KEY = 0x10, 15 SHIFT_KEY = 0x20, 16 } 17 18 protected MainGameObject root; 19 long frame; 20 ulong state; 21 shared ObjFile*[string] models; 22 shared ObjFile*[SC] screens; 23 Vector[][string][string] collision_objects; 24 25 this(MainGameObject root_object) 26 { 27 root = root_object; 28 } 29 30 void draw(GlobalState gs) 31 { 32 } 33 34 bool tick(GlobalState gs) 35 { 36 frame++; 37 return true; 38 } 39 40 void reset_frame() 41 { 42 frame = 0; 43 } 44 45 protected @property ulong gframe() 46 { 47 return root.frame; 48 } 49 } 50 51 class MainGameObject:GameObject 52 { 53 float scrx = 0.0, scry = 0.0; 54 ulong keys; 55 56 this(MainGameObject root) 57 { 58 super(root); 59 } 60 } 61 62 class StaticGameObject:GameObject 63 { 64 float x, y, z; 65 66 this(MainGameObject root) 67 { 68 super(root); 69 } 70 71 void load(string[string] s) 72 { 73 } 74 75 void save(ref string[string] s) 76 { 77 } 78 } 79 80 class LiveGameObject:StaticGameObject 81 { 82 float energy; 83 int lives; 84 string killed_by; 85 bool show_sensors; 86 87 this(MainGameObject root) 88 { 89 super(root); 90 } 91 }